//
//  ByPersonRecruitCell.m
//  jmsfhz_ios
//
//  Created by pro on 16/7/19.
//  Copyright © 2016年 pro. All rights reserved.
//

#import "ByPersonRecruitCell.h"

@implementation ByPersonRecruitCell

+ (instancetype)createCellInTableview:(UITableView *)table {
    
    static NSString *cellIdentifier = @"ByPersonRecruitCell";
    ByPersonRecruitCell *cell = [table dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell = [[self alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    return cell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style
              reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = [UIColor whiteColor];
        [self initSubviews];
    }
    return self;
}

- (void)initSubviews {
    
    /** 内容Label */
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, (SCREEN_WIDTH - 20) / 2, 15)];
    self.nameLabel.textColor = [UIColor darkGrayColor];
    self.nameLabel.font = FONT(14);
    self.nameLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:self.nameLabel];
    self.nameLabel.text = @"朱凯";
    
    /** 时间Label */
    self.dateLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.nameLabel.right, self.nameLabel.top, self.nameLabel.width, 15)];
    self.dateLabel.textColor = [UIColor lightGrayColor];
    self.dateLabel.font = FONT(12);
    self.dateLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:self.dateLabel];
    self.dateLabel.text = @"2016-07-06 09:13";
    
}

- (void)setModel:(ByNetNewsItemModel *)model {
    _model = model;
    [self setNeedsLayout];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.nameLabel.text = self.model.post_title;
    self.dateLabel.text = self.model.post_date;
}
@end
